<?php
include_once("../module/checkA.php");
include_once("../../config.php");
$plate=select_one_line_all_items($table_Prefix."plate","mid = 'product'");

/* TODO 应该每个页面都要权限判断，尤其是function.php页面 */
authorization('product');
?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php include_once(ROOT_PATH_.'/controlbase/module/head.php'); ?>
</head>

<body>

<div id="topbar">
    <?php include ROOT_PATH_ . '/controller/common/module/topbar.php'; ?>
</div>

<div id="container" class="<? echo $system_part ?>">

    <div id="maincontent">

        <div id="sidebar">
            <?php include ROOT_PATH_ . '/controller/common/module/sidebar.php'; ?>
        </div>






        <div id="content">
            <?php $page_title = '统计信息'; ?>
            <?php include ROOT_PATH_ . '/controlbase/module/mod-page-title.php'; ?>






            <?
//TODO 在时间段选择处，默认读取现在搜索的时间段。当天?>

<!--    <blockquote class="layui-elem-quote">-->
<!--        1.页面默认统计当天的数据。<br/>-->
<!--        2.更多时间段汇总可在根据实际情况在搜索框调整。-->
<!--    </blockquote>-->


    <div class="select-box clearfix layui-form">
        <form action="collect.php" >



            <div class="layui-form-item">
                <label class="layui-form-label">时间</label>

                <div class="layui-input-block">
                    <input type="text" name="select_startday" placeholder="请输入开始时间" autocomplete="off" class="layui-input"  onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" style="float: left; width: 112px" value="<?if($_REQUEST['select_startday']){echo $_REQUEST['select_startday'] ;} ?>" >

                    <span style="float: left;margin: 0 4px; line-height: 30px;">-</span>


                    <input type="text" name="select_endday" placeholder="请输入结束时间" autocomplete="off" class="layui-input" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"  style="float: left; width:112px" value="<?if($_REQUEST['select_endday']){echo $_REQUEST['select_endday'] ;} ?>"  >


                    <input type="hidden" name="nav-itemed"  value="product" >


                </div>


            </div>

		
            <button class="layui-btn  layui-btn-sm" name="search"  value="查找" ><i class="layui-icon">&#xe615;</i> 查找</button>
            
<!--            <button class="layui-btn  layui-btn-sm" name="search"  value="导出汇总" ><i class="layui-icon">&#xe615;</i> 导出汇总</button>-->
           
            <a class="layui-btn  layui-btn-sm" href="<?echo $domain?>/controlbase/product/collect.php?nav-itemed=order" ><i class="layui-icon">&#x1006;</i> 重置</a>
        </form>

        <br class="clearfloat"/>
    </div>







<!-- 用$system_part .list_boxes来控制来到确认板块信息显示-->
<div class="list-box">


<div class="list-boxes">

0.默认统计这个月
1.统计最好买的20个东西
2.统计最好赚的20个东西
3.智能补货（这里应该根据每次订单的数量和周期，预计不能支持下一周消耗的，都要提醒。提醒预计库存耗尽日期。）

<div>






    <table class="layui-table">

        <thead>
        <tr>

            <th>订单数量</th>
            
            <th>成功出单数量</th>
            <th>成功出单总价</th>
            <th>取消订单数量</th>    
            <th>取消订单总价</th>
        </tr>
        </thead>

        <tbody>
        <tr> 
            <td><?echo $total_order?></td>
            <td><?echo $total_confirm_order?></td>
            <td><?echo $total_confirm_price?>元</td>
            <td><?echo $total_cancel_order?></td>
            <td><?echo $total_cancel_price?>元</td>
        </tr>
</tbody>
</table>





</div>













<table class="layui-table">
  <colgroup>
    <col width="200">
    <col width="200">
	<col >
	<col >
	<col >
	<col >
	<col >
	<col >
	<col >
	<col >
	<col >

  </colgroup>
  <thead>
    <tr>
        <th>序号</th>
        <th>部门</th>
        <th>总订单数</th>
        <th>成功的订单数</th>
        <th>成功的订单总额</th>
        <th>失败的订单数</th>
        <th>成功的订单总额</th>
    </tr>
  </thead>
  <tbody>



  <?php
  if (count($orderlist) == 0)
  {
      echo "<tr><td colspan='12'>暂无数据</td></tr>";
  }
  ?>




	<?php
    $i=1;
    foreach($orderlist as $k=>$val)
    {
	

        ?>

      <tr id="item<?echo $val['user_id']?>" >
          <td><? echo $i++ ?></td>
          <td><? echo $val['user_name']; ?></td>
          <td><? echo $val['user_id'];?></td>
          <td><? echo $val['at1_count'];?></td>
          <td><? echo $val['at1_price'];?></td>
          
          <td><? echo $val['at2_count'];?></td>  
          <td><? echo $val['at2_price'];?></td>
        
          <td><? echo $val['at3_count'];?></td>
          <td><? echo $val['at3_price'];?></td>
       	  <td><? echo $val['daadline_order'];?></td>
          <td><? echo $val['at1_count']+$val['at2_count']+$val['at3_count'];?></td>
          
          <td><? echo $val['at1_price']+$val['at2_price']+$val['at3_price'];?></td>
      </tr>



  <?php

}
?>


  </tbody>
</table>






</div>




</div>


<!--list-box end-->
</div>

<!--content端點01-->
</div>
<!--maincontent端點01-->
<br class="clearfloat"/>
</div>
<!--container端點01-->
</div>







<!--删除box-->
<?php include '../module/deletebar.php'; ?>
<!--删除box end-->

<?php include ROOT_PATH_ . "/controller/common/module/footer.php"; ?> </body>
</html>
